const [ ERR_OK, ERR_NO, ERR_LG ] = [0, -1, 10]

class BaseModule {
  constructor(errno = -1, data, message) {
    if (!message && typeof data === 'string') {
        message = data
        data = null
    }
    this.errno = errno
    message && ( this.message = message )
    data && ( this.data = data )
  }
}

class SuccessModul extends BaseModule {
  constructor(data, message) {
    super(ERR_OK, data, message)
  }
}

class ErrorModule extends BaseModule {
  constructor(data, message) {
    super(ERR_NO, data, message)
  }
}

class UnLoginModule extends BaseModule {
  constructor(data, message) {
    super(ERR_LG, data, message)
  }
}

module.exports = {
  SuccessModul,
  ErrorModule,
  UnLoginModule
}